#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/9/16 15:07
# @Author: 王思淇
# @Email: xxx@gmail.com
# @File：change_page.py

from selenium.webdriver.common.by import By
from config.config import HOST
from pages.base_page import BasePage

class ChangePage(BasePage):
    url = "http://192.168.118.176/crm/index.php?m=task&a=edit&id=90".format(HOST)
    subject_locator = (By.NAME, 'subject')  # 主题
    owner_name_locator = (By.NAME, 'owner_name')  # 负责人
    to_role_id_locator = (By.XPATH, '//*[@id="ta1"]/span[1]/input')  # 选择负责人
    ui_button_locator = (By.XPATH, '/html/body/div[7]/div[3]/div/button[1]/span')  # ok
    baocun_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tfoot/tr/td[2]/input[1]')  # 保存

    def input_new_contacts(self,input_subjects):
        """输入主题"""
        self.driver.find_element(*self.subject_locator).clear()
        self.driver.find_element(*self.subject_locator).send_keys(input_subjects)

    def click_new_owner_name(self):
        """点击负责人"""
        self.driver.find_element(*self.owner_name_locator).click()

    def click_to_new_role_id(self):
        """选择负责人"""
        self.driver.find_element(*self.to_role_id_locator).click()
        self.driver.find_element(*self.to_role_id_locator).click()

    def click_new_ui_button(self):
        """ok"""
        self.driver.find_element(*self.ui_button_locator).click()
    def clike_baocuns(self):
        """保存"""
        self.driver.find_element(*self.baocun_locator).click()



